package com.all.ui;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.all.base.BaseActivity;
import com.all.ui.adapter.SimpleTreeAdapter;
import com.all.widget.tree.Node;
import com.all.widget.tree.bean.Bean;




public class TreeListActivity extends BaseActivity {

	Context mContext;
	private List<Bean> mDatas = new ArrayList<Bean>();
	/********  MODIFY*********/
	List<Node> mNodeList = new ArrayList<Node>();
	//树适配器
	private SimpleTreeAdapter<Bean> mAdapter;
	private ListView mTree;
	
	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.list_tree_activity);
		mContext = this;
		initDatas();
		mTree = (ListView) findViewById(R.id.id_tree);
	
		try {
			mAdapter = new SimpleTreeAdapter<Bean>(mTree,mContext,mDatas,10);
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		mTree.setAdapter(mAdapter);
	}

	
	
	

	private void initDatas()
	{
		mDatas.add(new Bean(1, 0, "根目录1"));
		mDatas.add(new Bean(2, 0, "根目录2"));
		mDatas.add(new Bean(3, 0, "根目录3"));
		mDatas.add(new Bean(4, 0, "根目录4"));
		mDatas.add(new Bean(5, 1, "子目录1-1"));
		mDatas.add(new Bean(6, 1, "子目录1-2"));

		mDatas.add(new Bean(7, 5, "子目录1-1-1"));
		mDatas.add(new Bean(8, 2, "子目录2-1"));

		mDatas.add(new Bean(9, 4, "子目录4-1"));
		mDatas.add(new Bean(10, 4, "子目录4-2"));

		mDatas.add(new Bean(11, 10, "子目录4-2-1"));
		mDatas.add(new Bean(12, 10, "子目录4-2-3"));
		mDatas.add(new Bean(13, 10, "子目录4-2-2"));
		mDatas.add(new Bean(14, 9, "子目录4-1-1"));
		mDatas.add(new Bean(15, 9, "子目录4-1-2"));
		mDatas.add(new Bean(16, 9, "子目录4-1-3"));

		/*mDatas2.add(new FileBean(1, 0, "文件管理系统"));
		mDatas2.add(new FileBean(2, 1, "游戏"));
		mDatas2.add(new FileBean(3, 1, "文档"));
		mDatas2.add(new FileBean(4, 1, "程序"));
		mDatas2.add(new FileBean(5, 2, "war3"));
		mDatas2.add(new FileBean(6, 2, "刀塔传奇"));

		mDatas2.add(new FileBean(7, 4, "面向对象"));
		mDatas2.add(new FileBean(8, 4, "非面向对象"));

		mDatas2.add(new FileBean(9, 7, "C++"));
		mDatas2.add(new FileBean(10, 7, "JAVA"));
		mDatas2.add(new FileBean(11, 7, "Javascript"));
		mDatas2.add(new FileBean(12, 8, "C"));*/

	}
	
	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub

	}

}
